package com.imooc.joe_springmvc1.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 *  事件的发布类
 * Created by joe on 16-8-10.
 * Application用来发布事件
 *
 *  使用ApplicationContext的publishEvent方法来发布
 */
@Component
public class DemoPublisher {
    @Autowired
    ApplicationContext applicationContext;

    public void publish(String msg){
        applicationContext.publishEvent(new DemoEvent(this,msg));
    }
}
